﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Skyworth.CRM.Service.Entity;
using Skyworth.CRM.Common;
using Skyworth.CRM.Service.IDAL;
using Skyworth.CRM.Service.IBLL;

namespace Skyworth.CRM.BLL
{
    public class UserBLL : IUserBLL
    {
        private IUserDAL _userDAL;

        public UserBLL(IUserDAL userDal)
        {
            _userDAL = userDal;
        }

        public void Add(Users model,List<int> roles)
        {
            _userDAL.Add(model, roles);
        }

        public void Update(Users model)
        {
            _userDAL.Update(model);
        }

        public void Update(Users model, List<int> roles)
        {
            _userDAL.Update(model, roles);
        }

        public void Delete(int userId)
        {
            _userDAL.Delete(userId);
        }

        public void SetUserAuthority(int modelId,IList<UserModules> list)
        {
            _userDAL.SetUserAuthority(modelId,list);
        }

        public bool Exists(string userName, string password, out int userId,out int individualId,out int userType)
        {
            return _userDAL.Exists(userName, password, out userId, out individualId, out userType);
        }

        public Users GetModel(int userId)
        {
            return _userDAL.GetModel(userId);
        }

        public DataTable Query(string strWhere)
        {
            return _userDAL.Query(strWhere);
        }
    }
}